//
//  MainViewController.m
//  OASystem
//
//  Created by zhoupengfei on 15/3/24.
//  Copyright (c) 2015年 zpf. All rights reserved.
//

#import "MainViewController.h"
#import "OALoginViewController.h"
@interface MainViewController ()<UIAlertViewDelegate>

- (IBAction)todoListAction:(id)sender;

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (IBAction)todoListAction:(id)sender {
    UIButton * btn  = (UIButton*)sender;
    switch (btn.tag) {
        case 1:
            //待办工作
            break;
            
        default:
            break;
    }
    
}
- (IBAction)logoutAction:(UIBarButtonItem *)sender {
    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:nil message:@"是否退出登录" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [alertView show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
    if (buttonIndex == 1) {
       OALoginViewController * loginVC = (OALoginViewController*) [self.storyboard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:loginVC];
        self.view.window.rootViewController = nav;
    }
}


@end
